﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using Lyh.Train.Data;
using System.Net;

namespace Lyh.Train.Common.Mail
{
    public class MailHelper
    {
        public static void Send(string from, string to, string subject, string body)
        {
            var message = new MailMessage(from, to, subject, body);
            message.Bcc.Add(Context.MailBcc);
            var client = new SmtpClient(Context.MailHost, Context.MailPort)
            {
                Credentials = new NetworkCredential(Context.MailAddress, Context.MailPassword),
            };
            client.Send(message);
            message.Dispose();
        }
    }
}
